package cn.iocoder.yudao.module.todo.dal.mysql.tasks;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.todo.dal.dataobject.tasks.TasksDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.todo.controller.admin.tasks.vo.*;

/**
 * 待办任务 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface TasksMapper extends BaseMapperX<TasksDO> {

    default PageResult<TasksDO> selectPage(TasksPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TasksDO>()
                .eqIfPresent(TasksDO::getSourceId, reqVO.getSourceId())
                .eqIfPresent(TasksDO::getGroupId, reqVO.getGroupId())
                .eqIfPresent(TasksDO::getSystemId, reqVO.getSystemId())
                .eqIfPresent(TasksDO::getTitle, reqVO.getTitle())
                .eqIfPresent(TasksDO::getDescription, reqVO.getDescription())
                .eqIfPresent(TasksDO::getDetailUrl, reqVO.getDetailUrl())
                .eqIfPresent(TasksDO::getStatus, reqVO.getStatus())
                .eqIfPresent(TasksDO::getPriority, reqVO.getPriority())
                .betweenIfPresent(TasksDO::getDueTime, reqVO.getDueTime())
                .betweenIfPresent(TasksDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TasksDO::getId));
    }

}